import TryGameNode from "./TryGameNode";
import { utils } from "./Utils";

const { ccclass, property } = cc._decorator;

@ccclass
export default class TryGamesWidget extends cc.Component {

    _tryGameNode: TryGameNode = null;
    _isShow: boolean = false;

    onLoad() {
        this._tryGameNode = this.getComponentInChildren("TryGameNode");
    }

    onEnable() {
        this.hide();
    }

    update(dt: number) {
        if (!this._isShow) {
            if (utils.wechatTool && utils.wechatTool.configData) {
                this.show();
            }
        }
    }

    public show() {
        this._isShow = true;
        this._tryGameNode.show();
    }

    public hide() {
        this._isShow = false;
        this._tryGameNode.hide();
    }

}
